<?php
/**
 * Created by PhpStorm.
 * User: mars
 * Date: 2019/2/1
 * Time: 6:19 PM
 */

namespace api\models;


use backend\models\form\AdForm;

class Options extends \common\models\Options
{


    public static function getAdByName($name)
    {
        $ad = AdForm::findOne(['type' => self::TYPE_AD, 'name' => $name]);
        $ad === null && $ad = \Yii::createObject(AdForm::className());

//        var_dump($ad);
        return [
            'ad'   => $ad->ad,
            'link' => $ad->link,
            'desc' => $ad->desc,
        ];
    }
}